#ifndef FOLLOWTHELEADER_H
#define FOLLOWTHELEADER_H
#include "FindRobots.hpp"
#include "Motor.h"
#include "Bumper.h"
#include "LED.h"
#include "send.h"
#include "swarmSocketServer.h"
#include "swarmSocketClient.h"
#include "Network.h"
#include "robotParser.h"
#include "cluster.h"
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <iostream>
#include "SwarmAlgorithm.hpp"

class FLAlgorithm: public SwarmAlgorithm {
private:
    bool follower[], isLeader;
    double angle, rad;
    int myFollower, myLeader, color;
    vector<bool> inTrain;
    map<int, double> dist;
    LED *led;
    vector<vector<string> > *algMessages;

    string readSwarmInst();
    void leaderQuery();
    void leaderDesignate();
    void leaderWaitForReady();
    void leaderWaitForTrain();

    void followerWaitForInstruction();
    void followerGetReady();
    void followerBecomeMiniLeader();

public:
    FLAlgorithm (vector<vector<string> > *algM);
    bool setup();
    void loopBody();

};

#endif
